home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Complementary Applications 2004 May / SGI IRIX 6.5 Complementary Applications 2004 May.iso / dist / OpenOffice.idb / usr / OpenOffice / help / en / sbasic.jar / text / sbasic / common / 03120308.xml < prev    next >
Encoding:
Extensible Markup Language  |  2002-01-24  |  4.9 KB  |  55 lines

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <html><head><title>RSet Statement [Runtime]</title><meta name="filename" content="text/sbasic/common/03120308"/><meta name="language" content="en-US"/><help:css-file-link xmlns:help="http://openoffice.org/2000/help"/><!--The CSS style header method for setting styles--><style type="text/css">
  3.  
  4.         p.P1{
  5.                 }
  6.         p.P2{
  7.                 }
  8.         span.T1{
  9.                 font-weight:bold;}
  10.         </style></head><body>
  11.   
  12.   
  13.   <help:to-be-embedded Eid="rset" xmlns:help="http://openoffice.org/2000/help">
  14.   <p class="Head1"><help:link Id="66602">RSet Statement [Runtime]</help:link></p>
  15.   <p class="Paragraph">Right-aligns a string within a string variable, or copies a user-defined variable type into another.</p>
  16.   </help:to-be-embedded>
  17.   <p class="Paragraph"><span class="T1">Syntax</span>:</p>
  18.   <p class="Paragraph">RSet Text As String = Text or RSet Variable1 = Variable2 <help:key-word value="RSet" tag="kw66602_1" xmlns:help="http://openoffice.org/2000/help"/></p>
  19.   <p class="Paragraph"><span class="T1">Parameter</span>:</p>
  20.   <p class="Paragraph">Text: Any string variable.</p>
  21.   <p class="Paragraph">Text: String to be right-aligned within the string variable.</p>
  22.   <p class="Paragraph">Variable1: User-defined variable as a target for the copied variable.</p>
  23.   <p class="Paragraph">Variable2: User-defined variable to be copied to another variable.</p>
  24.   <p class="Paragraph">If the string is shorter than the string variable, <span class="T1">RSet</span> aligns the string to the right within the string variable. Any remaining characters in the string variable are replaced with spaces. If the string is longer than the string variable, characters exceeding the length of the variable are truncated, and only the remaining characters are right-aligned within the string variable.</p>
  25.   <p class="Paragraph">The <span class="T1">RSet statement</span> can also be used to assign variables of one user-defined type to those of another.</p>
  26.   <p class="Paragraph">The example uses the <span class="T1">RSet</span> and <span class="T1">LSet</span> statements to modify the left and right alignment of a string.</p>
  27.   <p class="P2">Example:</p>
  28.   <p class="PropText">Sub ExampleRLSet</p>
  29.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>Dim sVar as string</p>
  30.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>Dim sExpr as string</p>
  31.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/></p>
  32.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>sVar = String(40,"*")</p>
  33.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>sExpr = "SBX"</p>
  34.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>REM <text:s text:c="" xmlns:text="http://openoffice.org/2000/text"/>Right-align "SBX" in a 40-character string</p>
  35.   <p class="PropText">REM <text:s text:c="" xmlns:text="http://openoffice.org/2000/text"/>Replace asterisks with spaces</p>
  36.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>RSet sVar = sExpr</p>
  37.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>Print ">"; sVar; "<"</p>
  38.   <p class="PropText"/>
  39.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>sVar = String(5,"*")</p>
  40.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>sExpr = "123457896"</p>
  41.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>RSet sVar = sExpr</p>
  42.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>Print ">"; sVar; "<"</p>
  43.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/></p>
  44.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>sVar = String(40,"*")</p>
  45.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>sExpr = "SBX"</p>
  46.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>REM Left-align "SBX" in a 40-character string</p>
  47.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>LSet sVar = sExpr</p>
  48.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>Print ">"; sVar; "<"</p>
  49.   <p class="PropText"/>
  50.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>sVar = String(5,"*")</p>
  51.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>sExpr = "123456789"</p>
  52.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>LSet sVar = sExpr</p>
  53.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>Print ">"; sVar; "<"<text:tab-stop xmlns:text="http://openoffice.org/2000/text"/><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/></p>
  54.   <p class="PropText">End Sub</p>
  55.  </body></html>